import React from 'react';
import { render } from 'react-dom'
import { Router, Route, IndexRoute,Redirect} from 'react-router'
import {Provider} from 'react-redux'
import store from '../redux/Store/Store'
import App from '../components/learn/App'
import Index from '../components/learn/Index'
import LearnCenter from '../components/learn/LearnCenter'
import GoodArticle from '../components/learn/GoodArticle'
import CourseDetail from '../components/learn/CourseDetail'
import AnswerHistory from '../components/learn/AnswerHistory'
import RadioList from '../components/learn/RadioList'
import RandomAnswerRecord from '../components/learn/RandomAnswerRecord'
import CourseTeacherDetail from '../components/learn/CourseTeacherDetail'
import CourseMore from '../components/learn/CourseMore'
import CharMore from '../components/learn/CharMore'
import TestOnline from '../components/learn/TestOnline'
import BroadChannel from '../components/learn/BroadChannel'
import Rank from '../components/learn/Rank'
import StudentRank from '../components/rank/StudentRank'
import CourseRank from '../components/rank/CourseRank'
import StudentDetail from '../components/rank/StudentDetail'
import TeacherDetail from '../components/rank/TeacherDetail'
import NewsCenter from '../components/learn/NewsCenter'
import PrivateLetter from '../components/learn/PrivateLetter'
import PrivateDialogue from '../components/learn/PrivateDialogue'
import PrivateDialogueTheme from '../components/learn/PrivateDialogueTheme'
import AnswerRecord from '../components/learn/AnswerRecord'
import ArticleDetail from '../components/learn/ArticleDetail'
import StoryLine from '../components/learn/StoryLine'
import TestPaper from '../components/learn/TestPaper'

import CourseManage from '../components/course/CourseManage'
// import EditCourse from '../components/course/EditCourse'

import adminRoutes from './admin'
import personalRoutes from './personal'

import Login from '../components/Login'
import Entrance from '../components/Entrance'
import BackPassword from '../components/BackPassword'

import NotFoundPage from '../components/NotFoundPage'

import AppShare from '../components/AppShare'

import MyPDF from '../components/MyPDF.jsx'

import registerServiceWorker from './registerServiceWorker'

import  '../style/css/font-awesome.min.css'; 

import * as pub from '../config/public';



render(
	<Provider store={store}>
       <Router history={pub.jumpHistory}>
         <Route path='Login' component={Login} />
         <Route path='Entrance' component={Entrance}/>
         <Route path='BackPassword' component={BackPassword}/>
         <Route path='AppShare' component={AppShare}/>



         <Route path='/' component={App}>
             <IndexRoute component={Index}/>
             <Route path='CourseManage' component={CourseManage}/>
             <Route path='CourseManage/AddCourse' component={CourseManage}/>
             <Route path='CourseManage/EditCourse/:id' component={CourseManage}/>
             <Route path='LearnCenter(/:code)' component={LearnCenter}/>
             <Route path='GoodArticle' component={GoodArticle}/>
             <Route path='CourseManage/CourseTeacherDetail/:id' component={CourseTeacherDetail}/>
             <Route path='CourseDetail/:id' component={CourseDetail}/>
             <Route path='AnswerHistory/:id' component={AnswerHistory}/>
             <Route path='CourseMore' component={CourseMore}/>
             <Route path='CharMore' component={CharMore}/>
             <Route path='TestOnline' component={TestOnline}/>
             <Route path='TestPaper/:id' component={TestPaper}/>
             <Route path='BroadChannel' component={BroadChannel}/>
             <Route path='Rank' component={Rank}/>
             <Route path='TeacherDetail/:name' component={TeacherDetail}/>
             <Route path='StudentRank' component={StudentRank}/>
             <Route path='StudentDetail/:name' component={StudentDetail}/>
             <Route path='CourseRank' component={CourseRank}/>
             <Route path='NewsCenter' component={NewsCenter}/>
             <Route path='PrivateLetter' component={PrivateLetter}/>
             <Route path='PrivateDialogue/:id' component={PrivateDialogue}/>
             <Route path='PrivateDialogueTheme/:id' component={PrivateDialogueTheme}/>
             <Route path='NewsCenter/AnswerRecord/:id' component={AnswerRecord}/>
             <Route path='NewsCenter/RadioList/:id' component={RadioList}/>
             <Route path='NewsCenter/RandomAnswerRecord/:id' component={RandomAnswerRecord}/>
             <Route path='ArticleDetail/:id(/:code)' component={ArticleDetail}/>
             <Route path='StoryLine' component={StoryLine}/>
             <Route path='MyPDF' component={MyPDF}/>
            
             {personalRoutes}
             
         </Route>


         {adminRoutes}
         


         <Route path='/404' component={NotFoundPage} />
         <Redirect from='*' to='/404' />
       </Router>
    </Provider>,
	document.getElementById('root')
);

// registerServiceWorker()

